<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<script type="text/javascript">

$(document).ready(function(){

});

//데이터 저장
function submitData(){
	getEnc();
	$("#hp").val($("#hp").val().split("-").join(""));
	$.ajax({
		url: "./insertUsr.do",
		dataType: "json",
		data:$("#frm").serialize(),
		success : function (json){
			if("0"==json.returnCd){
				showMsg("저장되었습니다");
			}else{
				showMsg("저장실패");
			}
		},
		error : function(error){
			seqChk = true;
			alert('접속지연이 발생했습니다. 몇분후에 다시 확인해주세요\n'+error);
		}
	});
	
}
function goList(){
	location.href="./main.do";
}
function getEnc(){
	if(window.hwInfo){
		$("#enc").val(window.hwInfo.getInfo());	
	}
}

function showMsg(msg){
	if(window.hwInfo){
		$("#enc").val(window.hwInfo.showMsg(msg));	
	}else{
		alert(msg);
	}
}

function usrDelete(){
	if($("input[name='del_chk']:checked").length ==0){
		alert("삭제할데이터를 선택해주세요");
		return;
	}
	if(confirm("삭제하시겠습니까?")){
		$("#frmDelete").submit();
	}
}

function usrInsert(){
	location.href="./intUsr.do";
}
</script>

<form name="src" id="src" action="./usrList.do">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
<!-- 		mav.addObject("cdList1", comaService.coma104Q(codeVo)); -->
<!-- 		codeVo.setCode_p_no("07"); -->
<!-- 		mav.addObject("cdList2", comaService.coma104Q(codeVo)); -->
		
<!-- 		mav.addObject("cdList3", service.adminCode(vo)); -->
			<td align="left">검색 
				<select name="src_search1">
					<option value="">지역</option>
	<c:if test="${cdList1 !=null && fn:length(cdList1)>0 }">
		<c:forEach var="cd" items="${cdList1}" varStatus="status">
				<option value="${cd.code_nm }" <c:if test="${param.src_search1==cd.code_nm }"> selected="selected"</c:if>>${cd.code_nm }</option>
		</c:forEach>
	</c:if>
				</select> 
				<select name="src_search2">
					<option value="">업종</option>
	<c:if test="${cdList2 !=null && fn:length(cdList2)>0 }">
		<c:forEach var="cd" items="${cdList2}" varStatus="status">
				<option value="${cd.code_no }" <c:if test="${param.src_search2==cd.code_no }"> selected="selected"</c:if>>${cd.code_nm }</option>
		</c:forEach>
	</c:if>
				</select> 
				<select name="src_search3">
					<option value="">업소</option>
	<c:if test="${cdList3 !=null && fn:length(cdList3)>0 }">
		<c:forEach var="cd" items="${cdList3}" varStatus="status">
				<option value="${cd.adm_seq }" <c:if test="${param.src_search3==cd.adm_seq }"> selected="selected"</c:if>>${cd.company }</option>
		</c:forEach>
	</c:if>
				</select> 
<jsp:useBean id="now" class="java.util.Date"/>
<fmt:formatDate value="${now}" pattern="yyyy" var="yyyy"  />
				<select name="syyyy">
					<option value="">년도</option>
<c:forEach begin="2014" end="${yyyy }" varStatus="stat" >
<option value="${stat.index }" <c:if test="${param.syyyy==stat.index }"> selected="selected"</c:if>>${stat.index }</option>
</c:forEach>
				</select> 
				<select name="smm">
					<option value="">월</option>
<c:forEach begin="1" end="12" varStatus="stat" >
	<c:if test="${stat.index  <10 }">
	<option value="0${stat.index }" <c:if test="${param.smm=='0'+stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
	<c:if test="${stat.index  >=10 }">
	<option value="${stat.index }" <c:if test="${param.smm==stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
</c:forEach>
				</select> 
				<select name="sdd">
					<option value="">일</option>
<c:forEach begin="1" end="31" varStatus="stat" >
	<c:if test="${stat.index  <10 }">
	<option value="0${stat.index }" <c:if test="${param.sdd=='0'+stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
	<c:if test="${stat.index  >=10 }">
	<option value="${stat.index }" <c:if test="${param.sdd==stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
</c:forEach>
				</select> ~
				<select name="eyyyy">
					<option value="">년도</option>
<c:forEach begin="2014" end="${yyyy }" varStatus="stat" >
<option value="${stat.index }" <c:if test="${param.eyyyy==stat.index }"> selected="selected"</c:if>>${stat.index }</option>
</c:forEach>
				</select> 
				<select name="emm">
					<option value="">월</option>
<c:forEach begin="1" end="12" varStatus="stat" >
	<c:if test="${stat.index  <10 }">
	<option value="0${stat.index }" <c:if test="${param.emm=='0'+stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
	<c:if test="${stat.index  >=10 }">
	<option value="${stat.index }" <c:if test="${param.emm==stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
</c:forEach>
				</select> 
				<select name="edd">
					<option value="">일</option>
<c:forEach begin="1" end="31" varStatus="stat" >
	<c:if test="${stat.index  <10 }">
	<option value="0${stat.index }" <c:if test="${param.edd=='0'+stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
	<c:if test="${stat.index  >=10 }">
	<option value="${stat.index }" <c:if test="${param.edd==stat.index }"> selected="selected"</c:if>>${stat.index }</option>
	</c:if>
</c:forEach>
				</select>
				닉네임
				<input name="src_all" value="${param.src_all }" type="text"/>
				<button onclick="$('#src').submit();" >검색</button>
			</td>
			<td align="right">
				<button onclick="usrDelete();return false;" >삭제</button>
				<button onclick="usrInsert();return false;" >등록</button>
			</td>
		</tr>
</table>
</form>

<form action="./deleteInfoAdm.do" id="frmDelete" method="get">
<table width="100%" border="0" cellspacing="1" cellpadding="2"
		class="class_admin_table">
		<colgroup>
			<col width="40" />
			<col width="80" />
			<col width="80" />
			<col width="*" />
			<col width="80" />
			<col width="130" />
			<col width="120" />
			<col width="100" />
			<col width="80" />
			<col width="250" />
			<col width="250" />
		</colgroup>
		<tr height="25" class="class_admin_table_head">
			<td align="center" ><input type="checkbox" name="" value="" /> </td>
			<td align="center" >유형</td>
			<td align="center"  >업종</td>
			<td align="center"  >업소명</td>
			<td align="center"  >회원정보</td>
			<td align="center"   >사이트</td>
			<td align="center"  >닉네임</td>
			<td align="center"  >전화번호</td>
			<td align="center" >등록일자</td>
			<td align="center" >특이사항</td>
			<td align="center" >비밀특이사항</td>
		</tr>
	<c:if test="${list !=null && fn:length(list)>0 }">
		<c:forEach var="data" items="${list}" varStatus="status">
		<tr height="25" class="class_admin_table_blank">
			<td align="center"><input type="checkbox" name="del_chk" value="${data.adm_seq },${data.mem_seq }" /></td>
			<td align="center">${data.user_type_nm }</td>
			<td align="center">${data.type_name }</td>
			<td align="center">${data.company }</td>
			<td align="center">${data.mem_seq }번</td>
			<td align="center">${data.con_site_nm }</td>
			<td align="center">
				<a href="./udtAdminUsr.do?adm_seq=${data.adm_seq }&mem_seq=${data.mem_seq}">${data.nick }</a>
			</td>
			<td align="center">
<c:set var="hp_arr" value="${fn:split(data.hp,',')}"/>
<c:forEach var="a_hp" items="${hp_arr}" varStatus="stat">
	<c:if test="${stat.index !=0 }"><br/></c:if>
			<c:if test="${fn:length(a_hp)==11 }">${fn:substring(a_hp,0,3) }-${fn:substring(a_hp,3,7) }-${fn:substring(a_hp,7,11) }</c:if>
			<c:if test="${fn:length(a_hp)==10 }">${fn:substring(a_hp,0,3) }-${fn:substring(a_hp,3,6) }-${fn:substring(a_hp,6,10) }</c:if>
			<c:if test="${fn:length(a_hp)!=10 && fn:length(a_hp)!=11 }">${a_hp }</c:if>
</c:forEach>
			</td>
			<td align="center">${data.reg_date }</td>
			<td align="center">${data.etc }</td>
			<td align="center">${data.sec_etc }</td>
		</tr>				
		</c:forEach>
	</c:if>
	<c:if test="${list ==null || fn:length(list)==0 }">
		<tr height="25" class="class_admin_table_blank">
			<td colspan="11" align="center">데이터가 없습니다</td>
		</tr>
	</c:if>

</table>

${pageHtml }
</form>

